//q1.cpp
//This Programs takes age, weight and height and prints a proper diet.
//
//Binyamin 22 december 2017
//-----------------------------------------------------------
#include <iostream>

using namespace std;
// 1. Prompt the user for age, height and weight.
// 2. store the age, height and weight.
// 3. calcuate the height/weight value.
// 4. find the ages range.
// 5. find the 'mbi' range.
// 6. print the appropriate diet.

int main()
{
	int age; // age - used to store the user age.
	int height; // height - used to store the user height.
	int weight; // weight - used to store the user weight.
	double mbi; // mbi - used to store the height/weight value.
	char diet; // diet - used to store the recommended diet.

	// Prompts.
	cout << "Please enter your age: ";
	cin >> age;
	cout << "Please enter your height: ";
	cin >> height;
	cout << "Please enter your weight: ";
	cin >> weight;
	mbi = (double)height / (double)weight;

	//Ifs
	if((age >=11) && (age <=20))
	{
		if((mbi >= 0.5)&&(mbi < 2))
		{
			diet = 'A';
		}
		else if((mbi >=2)&&(mbi <3.5))
		{
			diet = 'B';
		}
		else if((mbi >=3.5)&&(mbi<=5))
		{
			diet = 'C';
		}
	} // age > 20
	else if((age >=21) && (age <=40))
	{
		if((mbi >= 0.5)&&(mbi < 2))
		{
			diet = 'A';
		}
		else if((mbi >=2)&&(mbi <3.5))
		{
			diet = 'B';
		}
		else if((mbi >=3.5)&&(mbi<=5))
		{
			diet = 'A';
		}
	} // age > 40
	else if((age >=41) && (age <=120))
	{
		if((mbi >= 0.5)&&(mbi < 2))
		{
			diet = 'A';
		}
		else if((mbi >=2)&&(mbi <3.5))
		{
			diet = 'C';
		}
		else if((mbi >=3.5)&&(mbi<=5))
		{
			diet = 'C';
		}
	} // no match.
	cout << "To a person at the age of " << age <<", the height of " << height << " and the weight of " << weight << ", the recommended diet is " << diet << endl;
	return 0;
}
//output
//Please enter your age: 18 
//Please enter your height: 180 
//Please enter your weight: 60 
//To a person at the age of 18, the height of 180 and the weight of 60, the recommended diet is B
